package com.google.code.jmarias.client.tcp;

import com.google.code.jmarias.common.action.AbstractAction;
import java.util.Queue;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Proxy objekt predstavujici server z pohledu klienta. Klient muze prostrednictvim
 * teto tridy posilat serveru zpravy. Implementace je nezavisla na pouzitem protokolu.
 * @author Ondrej Michal
 */
public class RemoteServer {

    private static Log log = LogFactory.getLog(RemoteServer.class);

    /** Fronta pro akce zasilane serveru */
    private Queue<AbstractAction> clientToServerActions;

    public RemoteServer(Queue<AbstractAction> clientToServerActions) {
        this.clientToServerActions = clientToServerActions;
    }

    public void sendAction(AbstractAction action) {
        log.debug("Odesilam serveru akci " + action);
        clientToServerActions.offer(action);
    }
}